/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import request from '@/utils/request';

// 获取全寄订单列表
export async function getOrderList(params: any) {
  return request('/regiment/OrderMonitor/lists', {
    method: 'POST',
    data: params,
  });
}

// 创建导入任务
export async function createExportTask(params: any) {
  return request('/regiment/OrderMonitor/createExportTask', {
    method: 'POST',
    data: params,
  }).then((res) => {
    const { code, data, msg } = res;
    return {
      success: code == 0,
      data,
      msg,
    };
  });
}

// 取消订单
export async function orderCancel(params: any) {
  return request('/regiment/OrderMonitor/cancel', {
    method: 'POST',
    data: params,
  });
}

// 导出订单任务列表
export async function getDownloadTaskList() {
  return request('/regiment/OrderMonitor/exportTaskLists', {
    method: 'POST',
  }).then((res) => {
    const { code, data = {} } = res;

    return {
      success: code == 0,
      data: data.data,
    };
  });
}

// 获取查询条件
export async function getQueryConfig() {
  return request('/regiment/OrderMonitor/getQueryConfig', {
    method: 'POST',
  }).then(({ data, code }) => {
    return {
      success: code === 0 && data ? true : false,
      data,
    };
  });
}

/**
 * 客服取消订单
 *  */
export async function cancelOrder(params: any) {
  return request('/regiment/OrderMonitor/adminCancelOrder', {
    method: 'POST',
    data: params,
  });
}
